#include "file.h"
#include <QIODevice>
#include <QFile>
#include <QTextStream>
#include <QDebug>
file::file(){}

//文件读取函数
//自定义的文件读取函数  传入文件的地址 以及一个字符串列表的引用 因此就可以直接在这里面修改到外部的字符串的列表了
bool file::readFile(QString address,QStringList& Line)
{
    //D:\\EducationalAdministrationSystem_Qt\\student.csv
    //C:\\Users\\10480\\Desktop\\C++BigAssignment\\12.29\\EducationalAdministrationSystem_Qt

    QString pathjxy = "C:\\Users\\10480\\Desktop\\C++BigAssignment\\12.29\\EducationalAdministrationSystem_Qt\\";
    QString pathlkw = "D:\\EducationalAdministrationSystem_Qt\\";
    address =  pathjxy + address ;

    Line.clear();
    QFile file(address);
    if (!file.open(QIODevice::ReadOnly|QIODevice::Text))
        return false;
    QTextStream in(&file);
    while(!in.atEnd())
    {
        QString line = in.readLine();
        Line.append(line);
    }
    file.close();
    return true;
}
